"""
@author: Sergiy Tsymbalyuk
"""

import logging

from pylons import url
from pylons.i18n import lazy_ugettext as _

from repoze.what.plugins.pylonshq import ControllerProtector
from repoze.what.predicates import has_permission

from chowa.lib.site.crud import FlatCrudController
from hrms.model.education import School

log = logging.getLogger(__name__)

@ControllerProtector(has_permission('hrms.administer.education'))
class SchoolsController(FlatCrudController):
    __model__ = School
    __columns__ = ['short_name', 'full_name']
    __edit_columns__ = ['short_name', 'full_name']
    __view_url__ = ('full_name', lambda record_id: url(controller='education/school',
                                                       action='view',
                                                       id=record_id))
    __main_heading__ = _('Education')
